using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Jfc007.WebLib
{
    public class DownloadColumnTemplate : System.Web.UI.ITemplate
    {
        //Shared itemcount As Integer = 0
        private System.Web.UI.WebControls.ListItemType mobjTemplateType;
        private string mstrID;
        private string mstrCaption;
        public DownloadColumnTemplate(string id, string caption, ListItemType type)
        {
            mobjTemplateType = type;
            mstrID = id;
            mstrCaption = caption;
            if (mstrCaption == String.Empty)
            {
                mstrCaption = "Download";
            }

        }

        public void InstantiateIn(System.Web.UI.Control container)
        {
            System.Web.UI.WebControls.HyperLink objButton = new HyperLink();

            switch (mobjTemplateType)
            {
                case ListItemType.Item:
                case ListItemType.AlternatingItem:
                case ListItemType.SelectedItem:
                    {
                        objButton.Text = mstrCaption;
                        objButton.NavigateUrl =
                        objButton.ID = mstrID;
                        break;
                    }
            }
            container.Controls.Add(objButton);
            //itemcount += 1
        }
    }
}